package com.zrf.base.knowledge.java;

/**
 * 异常丢失demo
 * try 和 finally都会跑出异常，之后只捕捉到finally的异常
 * try的异常丢失
 * @author zhouruifeng
 *         create at 2017/5/7.
 */
public class LoseException {
    static void i() throws ImportantException {
        throw new ImportantException();
    }

    static void l() throws LightException {
        throw new LightException();
    }

    public static void main(String[] args) {
        try {
            try {
                i();
            } finally {
                l();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

class ImportantException extends Exception {
    public String toString() {
        return "import";
    }
}

class LightException extends Exception {
    public String toString() {
        return "light";
    }
}

